<?php

/**
 * TimeCardDay filter form base class.
 *
 * @package    virtualstore
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseTimeCardDayFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'time_card_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TimeCard'), 'add_empty' => true)),
      'date'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'shift1'        => new sfWidgetFormFilterInput(),
      'shift2'        => new sfWidgetFormFilterInput(),
      'shift3'        => new sfWidgetFormFilterInput(),
      'holiday_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Holiday'), 'add_empty' => true)),
      'restDay'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'position_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Position'), 'add_empty' => true)),
      'shift_day_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ShiftDay'), 'add_empty' => true)),
      'regularHours'  => new sfWidgetFormFilterInput(),
      'overtimeHours' => new sfWidgetFormFilterInput(),
      'created_at'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'created_by'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('created_by_fk'), 'add_empty' => true)),
      'updated_by'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('updated_by_fk'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'time_card_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TimeCard'), 'column' => 'id')),
      'date'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'shift1'        => new sfValidatorPass(array('required' => false)),
      'shift2'        => new sfValidatorPass(array('required' => false)),
      'shift3'        => new sfValidatorPass(array('required' => false)),
      'holiday_id'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Holiday'), 'column' => 'id')),
      'restDay'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'position_id'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Position'), 'column' => 'id')),
      'shift_day_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ShiftDay'), 'column' => 'id')),
      'regularHours'  => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'overtimeHours' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'created_at'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_by'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('created_by_fk'), 'column' => 'id')),
      'updated_by'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('updated_by_fk'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('time_card_day_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TimeCardDay';
  }

  public function getFields()
  {
    return array(
      'id'            => 'Number',
      'time_card_id'  => 'ForeignKey',
      'date'          => 'Date',
      'shift1'        => 'Text',
      'shift2'        => 'Text',
      'shift3'        => 'Text',
      'holiday_id'    => 'ForeignKey',
      'restDay'       => 'Boolean',
      'position_id'   => 'ForeignKey',
      'shift_day_id'  => 'ForeignKey',
      'regularHours'  => 'Number',
      'overtimeHours' => 'Number',
      'created_at'    => 'Date',
      'updated_at'    => 'Date',
      'created_by'    => 'ForeignKey',
      'updated_by'    => 'ForeignKey',
    );
  }
}
